package com.totoro.mybatis.mul_datasource_dynamic.dao.user;

import com.totoro.mybatis.mul_datasource_dynamic.domain.user.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Created by Niki on 2018/8/15 12:02
 */
@Mapper
public interface UserDao {

    @Select("select * from user ")
    List<User> queryAll();

    @Select("select * from user where id = #{id}")
    User queryById(@Param("id") int id);

    @Insert("insert into user(name, age) values(#{name},#{age})")
    @SelectKey(keyProperty = "id",keyColumn = "id",resultType = Integer.class,before = false,statement = "select last_insert_id()")
    int insertUser(User user);
}
